<template>
  <div class="ant-list ant-list-split">
    <ul class="ant-list-items">
      <li class="ant-list-item">
        <div class="ant-list-item-meta">
          <div class="ant-list-item-meta-content">
            <h4 class="ant-list-item-meta-title">接收系统通知</h4>
            <div class="ant-list-item-meta-description">系统通知、系统公告</div>
          </div>
        </div>
        <div class="ant-list-item-action">
          <el-switch v-model="emailForm.value1" />
        </div>
      </li>
      <li class="ant-list-item">
        <div class="ant-list-item-meta">
          <div class="ant-list-item-meta-content">
            <h4 class="ant-list-item-meta-title">接收待办消息</h4>
            <div class="ant-list-item-meta-description">
              所有来自待办中心的消息提醒（此邮件能让员工离线时不漏掉重要工作）
            </div>
          </div>
        </div>
        <div class="ant-list-item-action">
          <el-switch v-model="emailForm.value1" />
        </div>
      </li>
      <li class="ant-list-item">
        <div class="ant-list-item-meta">
          <div class="ant-list-item-meta-content">
            <h4 class="ant-list-item-meta-title">接收工作通知</h4>
            <div class="ant-list-item-meta-description">
              所有来自工作通知的消息，包含各类工作任务、项目等来自工作计划等通知
            </div>
          </div>
        </div>
        <div class="ant-list-item-action">
          <el-switch v-model="emailForm.value1" />
        </div>
      </li>
      <li class="ant-list-item">
        <div class="ant-list-item-meta">
          <div class="ant-list-item-meta-content">
            <h4 class="ant-list-item-meta-title">每日日程邮件提醒</h4>
            <div class="ant-list-item-meta-description">
              每天需要处理的工作任务提醒
            </div>
          </div>
        </div>
        <div class="ant-list-item-action">
          <el-switch v-model="emailForm.value1" />
        </div>
      </li>
    </ul>
  </div>
</template>

<script lang="ts" setup>
import { reactive } from "vue";
// import { reactive, ref } from "vue";
// import type { FormInstance } from "element-plus";

// const pswdFormDialogVisible = ref(false);
// const phoneFormDialogVisible = ref(false);
// const emailFormDialogVisible = ref(false);
// const secretFormDialogVisible = ref(false);

const emailForm = reactive({
  value1: true,
});

// const saveLoading = ref(false);

// 绑定邮箱
// const submitEmailForm = async (formEl: FormInstance | undefined) => {
//   if (!formEl) {
//     return;
//   }
//   await formEl.validate((valid, fields) => {
//     if (valid) {
//       console.log("submit!");
//       console.log(fields);
//       saveLoading.value = true;
//     } else {
//       console.log("error submit!", fields);
//     }
//   });
// };

// const resetForm = (formEl: FormInstance | undefined) => {
//   if (!formEl) {
//     return;
//   }
//   formEl.resetFields();

//   pswdFormDialogVisible.value = false;
//   phoneFormDialogVisible.value = false;
//   emailFormDialogVisible.value = false;
//   secretFormDialogVisible.value = false;
// };
</script>

<style lang="less" scoped>
.ant-list {
  width: 100%;
}

.ant-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  color: rgba(0, 0, 0, 0.85);
}

.ant-list-split .ant-list-item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* .ant-list-split .ant-list-item:last-child {
  border-bottom: none;
} */

.ant-list-item-meta {
  display: flex;
  flex: 1 1;
  align-items: flex-start;
  max-width: 100%;
}

.ant-list-item-meta-content {
  flex: 1 0;
  width: 0;
  color: rgba(0, 0, 0, 0.85);
}

.ant-list-item-action {
  flex: 0 0 auto;
  margin-left: 48px;
  padding: 0;
  font-size: 0;
  list-style: none;
}

.ant-list-item-meta-title {
  margin-bottom: 4px;
  color: rgba(0, 0, 0, 0.85);
  font-size: 14px;
  line-height: 1.5715;
}

.ant-list-item-meta-description {
  color: rgba(0, 0, 0, 0.45);
  font-size: 14px;
  line-height: 1.5715;
}
</style>
